#define _CRT_SECURE_NO_WARNINGS 1

#include <stack>

using namespace std;

class MyQueue {
public:
    MyQueue() {

    }

    void push(int x) {
        pushst.push(x);
    }

    int pop() {
        if (popst.empty())
        {
            while (!pushst.empty())
            {
                popst.push(pushst.top());
                pushst.pop();
            }
        }
        int x = popst.top();
        popst.pop();
        return x;
    }

    int peek() {
        if (popst.empty())
        {
            while (!pushst.empty())
            {
                popst.push(pushst.top());
                pushst.pop();
            }
        }
        return popst.top();
    }

    bool empty() {
        return pushst.empty() && popst.empty();
    }
    stack<int> pushst;
    stack<int> popst;

};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */